'use strict'

const Koa = require('koa');
const server = new Koa();
// const Router = require('koa-router')
const path = require('path')
const projectStatic = require('koa-static');
const logger = require('koa-logger');
// const bodyParser = require('koa-bodyparser')

const port = parseInt(process.env.PORT, 10) || 10000
const router = require('./middlewares/router')
  // console.log(router)

  server.use(logger())
        // .use(async (ctx, next) => {
        //   ctx.res.statusCode = 200
        //   await next()
        // })
        // .use(bodyParser())
        .use(projectStatic(path.join( __dirname, './project')))
        .use(router.routes())
        .use(router.allowedMethods())
        // .use((server)=>router(server))
        .listen(port, (err) => { if (err) throw err })